<template>
  <div class="container-hoslist">
    <ul class="hos-list">
      <li class="list-item" v-for="(item, index) in hospitalList" :key="index">
        <div class="checkbox" v-if="isEdit">
          <img v-if="item.isChecked" :src="base_url+'/checked.png'" alt @click="changeChecked(item)" />
          <img v-if="!item.isChecked" :src="base_url+'/check.png'" alt @click="changeChecked(item)" />
        </div>
        <div class="main" @click="to_detail(item)">
          <div class="left">
            <!-- 头像 -->
            <div class="hos-logo">
              <img :src="img_url+item.logo" v-if="img_url&&item.logo" alt class="img" />
              <!-- 下架 -->
              <img v-if="item.status==1" class="xiajia" :src="base_url+'/xiajia.png'" alt />
            </div>
          </div>
          <!-- 医院信息 -->
          <div class="info">
            <div class="hos-name">{{item.name}}</div>
            <div class="address" v-if="item.address">
              <div class="icon">
                <img :src="base_url+'/mp_2.4/search/dingwei.png'" v-if="base_url" alt class="img" />
              </div>
              <div class="msg">{{item.address}}</div>
            </div>
            <div class="tip" v-if="item.label">{{item.label}}</div>
            <!-- 医生数 项目数 -->
            <div class="tags clearfix">
              <div class="tag-item" v-if="item.reservationNumber">预约: {{item.reservationNumber}}</div>
              <span class="hang" v-if="item.caseNumber">|</span>
              <div class="tag-item" v-if="item.caseNumber">案例: {{item.caseNumber}}</div>
            </div>
            <!-- 右上角等级 -->
            <div class="leval" v-if="item.tag">
              <div class="msg">{{item.tag}}</div>
            </div>
          </div>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import common from "@/assets/js/mmk_common.js";
export default {
  data() {
    return {
      base_url: common.image_resource,
      img_url: common.image_response,
      score: 4
    };
  },
  props: {
    isEdit: false,
    hospitalList: []
  },
  watch: {
    hospitalList(newval, oldval) {
      this.hospitalList = newval;
    }
  },
  methods: {
    // 编辑选择
    changeChecked(item) {
      item.isChecked = !item.isChecked;
      this.$emit("hospitalClick", this.hospitalList);
    },
    // 查看详情
    to_detail(item) {
      if (item.status == 1) {
        return;
      }
      wx.navigateTo({
        url: "/pages/package_projects/hospital_detail/main?hos_id=" + item.id
      });
    }
  }
};
</script>

<style lang="less" scoped>
.container-hoslist {
  width: 100%;
  .hos-list {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    .list-item {
      display: flex;
      align-items: center;
      margin-bottom: 10px;
      position: relative;
      .checkbox {
        width: 20px;
        height: 20px;
        margin-right: 15px;
        img {
          width: 20px;
          height: 20px;
        }
      }
      .main {
        width: 100%;
        padding: 10px;
        background: rgba(255, 255, 255, 1);
        box-shadow: 0px 2px 6px 0px rgba(240, 240, 240, 1);
        border-radius: 5px;
        box-sizing: border-box;
        display: flex;
        .left {
          width: 50px;
          height: 50px;
          position: relative;
          .hos-logo {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            background-color: #ccc;
            position: relative;
            .img {
              width: 100%;
              height: 100%;
              display: block;
            }
            .xiajia,
            .quehuo {
              position: absolute;
              top: 0;
              left: 0;
              width: 100%;
              height: 100%;
              z-index: 11;
            }
          }
          .tip {
            width: 11px;
            height: 11px;
            position: absolute;
            bottom: 1px;
            right: 3px;
            .img {
              width: 100%;
            }
          }
        }
        .info {
          flex: 1;
          padding-left: 10px;
          .hos-name {
            width: 70%;
            font-size: 16px;
            font-family: "PingFangSC-Regular";
            font-weight: 400;
            color: rgba(51, 51, 51, 1);
            line-height: 22px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 1;
            -webkit-box-orient: vertical;
          }
          .address {
            margin-top: 5px;
            display: flex;
            .icon {
              width: 12px;
              padding-top: 2px;
              .img {
                width: 11px;
                height: 12px;
                display: block;
              }
            }
            .msg {
              flex: 1;
              font-size: 12px;
              font-family: "PingFangSC-Regular";
              font-weight: 400;
              color: rgba(102, 102, 102, 1);
              line-height: 17px;
              overflow: hidden;
              text-overflow: ellipsis;
              display: -webkit-box;
              -webkit-line-clamp: 1;
              -webkit-box-orient: vertical;
            }
          }
          .tip {
            width: 84px;
            height: 16px;
            background: rgba(255, 211, 156, 1);
            box-shadow: 0px 1px 1px 0px rgba(255, 91, 118, 0.42);
            border-radius: 11px;
            font-size: 10px;
            font-family: "PingFangSC-Medium", "PingFang SC";
            font-weight: 500;
            color: rgba(255, 255, 255, 1);
            line-height: 16px;
            text-align: center;
            margin-top: 10px;
          }
          .tags {
            margin-top: 10px;
            .tag-item {
              height: 20px;
              font-size: 12px;
              font-family: "PingFangSC-Regular";
              font-weight: 400;
              color: #999999;
              line-height: 20px;
              text-align: center;
              display: inline-block;
              margin-right: 10px;
            }
            .hang {
              display: inline-block;
              width: 3px;
              height: 10px;
              color: #d8d8d8;
              border-radius: 2px;
              margin-right: 10px;
            }
          }
        }
      }
      .leval {
        position: absolute;
        top: 13px;
        right: 15px;
        .msg {
          padding-left: 12px;
          padding-right: 6px;
          height: 15px;
          line-height: 15px;
          background: rgba(255, 152, 108, 1);
          box-shadow: 0px 1px 1px 0px rgba(255, 91, 118, 0.42);
          border-radius: 7px;
          font-size: 10px;
          font-family: PingFangSC-Medium;
          font-weight: 500;
          color: rgba(255, 255, 255, 1);
          position: relative;
          &::before {
            content: "";
            width: 18px;
            height: 18px;
            line-height: 18px;
            text-align: center;
            border-radius: 50%;
            display: block;
            background-image: url("https://h5.ameimeika.com/mp_images/mp_2.4/search/vvvvv@2x.png");
            background-repeat: no-repeat;
            background-size: cover;
            box-shadow: 0px 1px 2px 0px rgba(255, 98, 117, 0.61);
            position: absolute;
            left: 0;
            top: 50%;
            transform: translate(-50%, -50%);
            font-size: 12px;
            font-weight: 500;
            color: rgba(255, 255, 255, 1);
          }
        }
      }
    }
  }
}
</style>


